Skip to content

Keep the lint files Codacy reads to packages Codacy installs - #158

Merged
PDowney merged 1 commit into
mainfrom
codacy-config-files
Nov 25, 2026
Merged

PDowney merged 1 commit into
mainfrom
codacy-config-files

Conversation

@PDowney

@PDowney PDowney commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

Codacy reads phpcs.xml, eslint.config.mjs and .stylelintrc.json (the "Configuration file" setting is on for each), but it installs no WordPress coding standards, no PHPCSExtra, and no WordPress ESLint or Stylelint packages. Codacy's analysis log for 7d7fcc8 shows all three tools failing:

  • PHPCS: Referenced sniff "WordPress-Extra" does not exist
  • ESLint: Cannot find package '@wordpress/eslint-plugin'
  • Stylelint: Could not find "@wordpress/stylelint-config"

So Codacy checked none of the plugin's PHP, JavaScript or CSS with those tools.

Each tool now has a file Codacy can run and a full file that composer, npm and CI run. The plugin's own checks are unchanged.

Tool Codacy reads Composer, npm and CI run
PHPCS phpcs.xml: the rules from PHPCS's own standards and VariableAnalysis that the WordPress standards apply, with their exact settings and the 4-column tab width, plus PHPCompatibilityWP phpcs-wordpress.xml (the former phpcs.xml)
Stylelint .stylelintrc.json: the 60 plain Stylelint rules of the WordPress config stylelint-wordpress.json (the former .stylelintrc.json)
ESLint eslint.config.mjs: the project's modern-JavaScript rules eslint.wordpress.config.mjs: the WordPress set, the same rules, and the browser-support check (compat reads the browser list from package.json, which extends @wordpress/browserslist-config, also missing in Codacy). The resolved configuration is identical

.github/scripts/codacy-configs.py regenerates the rules in phpcs.xml and .stylelintrc.json from the full files. It reads PHPCS's loaded ruleset through .github/scripts/phpcs-ruleset-dump.php, a report class. The "Run PHPCS" and "Run Stylelint" steps fail when either copy is out of date, for example after a Dependabot update to the WordPress standards.

Codacy still can't run any WordPress-specific rule; those keep running only in CI.

Testing

  • Generated phpcs.xml: no findings on the plugin. Its loaded ruleset matches phpcs-wordpress.xml for all 213 rules from Codacy-installed standards (same sniffs, properties, severities and types). Every listed sniff is in Codacy's PHPCS catalog.
  • eslint --print-config output for tests/js/helpers.mjs and tests/js/info-window.test.mjs is byte-identical before and after with the full config. Both configs lint clean, and every rule in eslint.config.mjs is in Codacy's ESLint 9 catalog.
  • Both Stylelint configs lint clean.
  • composer check-all (PHPCS, PHPMD, Psalm, PHPStan, Rector, 152 PHPUnit tests), npm run lint:js, lint:css, lint:md, npm test (10), Ruff, strict mypy, Bandit through Prospector, yamllint, actionlint, zizmor (no change) and gitleaks pass.

After merge, the Codacy log for the merge commit should show PHP_CodeSniffer, ESLint9 and Stylelint as success.

🤖 Generated with Claude Code

Codacy reads phpcs.xml, eslint.config.mjs, and .stylelintrc.json, but it
installs no WordPress coding standards, no PHPCSExtra, and no WordPress
ESLint or Stylelint packages, so every analysis failed for those three
tools and Codacy checked nothing with them.

Each tool now has a file Codacy can run and a full file that composer,
npm, and CI run, so the plugin's own checks are unchanged:

- PHPCS: phpcs-wordpress.xml is the former phpcs.xml. phpcs.xml holds the
  rules from PHPCS's own standards and VariableAnalysis that the
  WordPress standards apply, with their settings and the tab width, plus
  PHPCompatibilityWP.
- Stylelint: stylelint-wordpress.json is the former .stylelintrc.json.
  .stylelintrc.json holds its 60 plain Stylelint rules.
- ESLint: eslint.config.mjs exports the project's rules;
  eslint.wordpress.config.mjs adds the WordPress set and the
  browser-support check (its browser list extends
  @wordpress/browserslist-config), so the resolved configuration is
  unchanged.

.github/scripts/codacy-configs.py regenerates phpcs.xml's rules and
.stylelintrc.json from the full files, and CI fails when they are out
of date.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation security dependencies Pull requests that update a dependency file automation testing labels Nov 25, 2026
@codacy-production

codacy-production Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 44 complexity · 0 duplication

Metric Results
Complexity 44
Duplication 0

View in Codacy

🟢 Coverage ∅ diff coverage · +0.00% coverage variation

Metric Results
Coverage variation ✅ +0.00% coverage variation (-1.00%)
Diff coverage ✅ ∅ diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (7d7fcc8) 263 238 90.49%
Head commit (d7efdc6) 263 (+0) 238 (+0) 90.49% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#158) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for contributing to Optimizations ACE MC!

Before we review:

  • Have you tested your changes with WordPress 7.0+?
  • Are your changes compatible with PHP 8.3+?
  • Have you followed WordPress coding standards?
  • Did you update the CHANGELOG.md if needed?

Security Reminder
This plugin changes WooCommerce, WP Store Locator, and WordPress admin screens, so please ensure:

  • All user input is properly sanitized
  • All output is properly escaped
  • No security vulnerabilities are introduced

We'll review your PR soon.

@PDowney
PDowney merged commit 52a8db8 into main Nov 25, 2026
31 checks passed
@github-actions
github-actions Bot deleted the codacy-config-files branch November 25, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation security testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant